package com.offcn.controller;

import com.offcn.pojo.User;
import com.offcn.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("users")
public class UserController {

    // 注入业务层(控制层(表现层)调用业务层)
    @Autowired
    private UserService userService;

    @GetMapping
    public String toList(Model model){
        List<User> list = userService.queryMore();
        model.addAttribute("list",list);
        return "user_list";
    }
}
